Skip to content

feat: single staticlib#79

Merged
fogsong233 merged 5 commits intoclice-io:mainfrom
fogsong233:feat-single-staticlib
Mar 26, 2026
Merged

feat: single staticlib#79
fogsong233 merged 5 commits intoclice-io:mainfrom
fogsong233:feat-single-staticlib

Conversation

@fogsong233
Copy link
Copy Markdown
Collaborator

@fogsong233 fogsong233 commented Mar 26, 2026

Summary by CodeRabbit

  • New Features
    • Added a new static library component that exposes public headers and consolidates core functionality.
    • Supports optional integrations for serialization formats, async support, testing utilities, and language/ipc features — enabled conditionally via configuration.
    • Adds an optimized archive-merge build behavior when tests are not enabled.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 26, 2026

📝 Walkthrough

Walkthrough

Added a new non-default static library target eventide in xmake.lua that exports public headers, conditionally wires multiple public dependencies and packages based on build options, and enables merge-archive behavior when tests are not enabled.

Changes

Cohort / File(s) Summary
Build Configuration
xmake.lua
Added target("eventide") (non-default, static) with add_includedirs("include", { public = true }) and add_headerfiles("include/(eventide/**)"). Configured conditional public dependencies: always common, reflection; feature-gated serde (and format adapters/packages), option, deco (when both deco+option), ztest (+cpptrace), async (+libuv), and when async+serde+serde_simdjson also expose ipc and language. When not has_config("test"), applies utils.merge.archive and sets build.merge_archive policy.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • revert: "build: add xmake ci" #2 — Modifies xmake.lua targeting the same eventide target (removes eventide / ztest), directly conflicts with target declaration changes.
  • fix: xmake #30 — Adjusts header export globs in xmake.lua, related to the added include/(eventide/**) header exports.
  • build: add xmake ci #1 — Also adds or modifies the eventide target and its public dependency declarations in xmake.lua.

Poem

🐰 In the build bed where headers sleep, I sow,
A static seed named Eventide begins to grow,
It links with friends when toggles sing,
Merges archives — a tidy thing,
Hop, hop, dependencies in a row! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: single staticlib' directly corresponds to the main change: adding a new static library target named 'eventide' that consolidates public dependencies into a single static archive.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
xmake.lua (1)

242-271: The option→dep wiring is repetitive and may drift over time.

This block duplicates a large conditional matrix. A tiny helper for optional public deps/packages would make updates safer and shorter.

Refactor sketch
+local function add_public_dep_if(opt, dep, pkgs)
+	if has_config(opt) then
+		add_deps(dep, { public = true })
+		if pkgs then
+			add_packages(table.unpack(pkgs), { public = true })
+		end
+	end
+end
...
-	if has_config("option") then
-		add_deps("option", { public = true })
-	end
+	add_public_dep_if("option", "option")
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@xmake.lua` around lines 242 - 271, Replace the repetitive conditional wiring
by extracting a small helper that checks has_config and adds public
deps/packages in one place; implement a function (e.g., add_optional =
function(cfg, dep_names, pkg_names) ...) that calls has_config(cfg) and then
add_deps(..., { public = true }) and add_packages(..., { public = true }) as
needed, then use it for "serde" and its sub-features ("serde_simdjson" -> add
"serde_json" + "simdjson","yyjson"; "serde_flatbuffers" -> "serde_flatbuffers" +
"flatbuffers"; "serde_toml" -> "serde_toml" + "toml++"), and for "option",
"deco" (guard deco on has_config("option") too), "ztest" (add "ztest" + package
"cpptrace") and "async" (add "async" + package "libuv") to remove duplicated
has_config/add_deps/add_packages calls while preserving public=true semantics.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@xmake.lua`:
- Around line 233-236: The current guard around has_config("test") prevents
add_rules("utils.merge.archive") and set_policy("build.merge_archive", true)
from being applied by default (since test defaults to true); to restore
single-staticlib behavior by default, remove the conditional and invoke
add_rules("utils.merge.archive") and set_policy("build.merge_archive", true)
unconditionally (or move those two calls outside the if not has_config("test")
block) so the merge-archive rule and policy are always set unless explicitly
overridden.

---

Nitpick comments:
In `@xmake.lua`:
- Around line 242-271: Replace the repetitive conditional wiring by extracting a
small helper that checks has_config and adds public deps/packages in one place;
implement a function (e.g., add_optional = function(cfg, dep_names, pkg_names)
...) that calls has_config(cfg) and then add_deps(..., { public = true }) and
add_packages(..., { public = true }) as needed, then use it for "serde" and its
sub-features ("serde_simdjson" -> add "serde_json" + "simdjson","yyjson";
"serde_flatbuffers" -> "serde_flatbuffers" + "flatbuffers"; "serde_toml" ->
"serde_toml" + "toml++"), and for "option", "deco" (guard deco on
has_config("option") too), "ztest" (add "ztest" + package "cpptrace") and
"async" (add "async" + package "libuv") to remove duplicated
has_config/add_deps/add_packages calls while preserving public=true semantics.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3f7b7cc1-9114-43ec-acf4-c4ea863e965c

📥 Commits

Reviewing files that changed from the base of the PR and between 491c27d and e6ef915.

📒 Files selected for processing (1)
  • xmake.lua

@fogsong233 fogsong233 merged commit 37dc1ed into clice-io:main Mar 26, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant